package test1230pm;

public class Test01 {
    public static void main(String[] args) {
        // (1)设计一个长方形类
        // 属性：长、宽
        // 功能：周长、面积
        // 要求：分别创建3个不同的对象、求周长、求面积
        Cfx cfx1 = new Cfx(2,3);
        Cfx cfx2 = new Cfx(4,1);
        Cfx cfx3 = new Cfx(6,9);
        System.out.println("长方形1的周长：" + cfx1.getCircumference());
        System.out.println("长方形1的面积：" + cfx1.getSqure());
        System.out.println("长方形2的周长：" + cfx2.getCircumference());
        System.out.println("长方形2的面积：" + cfx2.getSqure());
        System.out.println("长方形3的周长：" + cfx3.getCircumference());
        System.out.println("长方形3的面积：" + cfx3.getSqure());
    }

}
class Cfx {
    int length;
    int width;
    public double getSqure() {
        return length * width;
    }
    public double getCircumference() {
        return 2 * (length + width);
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public Cfx(int length, int width) {
        this.length = length;
        this.width = width;
    }

    public Cfx() {
    }
}
